import { PrismaClient } from '@prisma/client'

const testConnection = async () => {
    const prisma = new PrismaClient()

    try {
        // 尝试连接数据库
        await prisma.$connect()
        console.log('✅ 数据库连接成功')

        // 测试查询
        const result = await prisma.$queryRaw`SELECT version();`
        console.log('PostgreSQL 版本:', result[0].version)

    } catch (error) {
        console.error('❌ 数据库连接失败:', error)
    } finally {
        await prisma.$disconnect()
    }
}

testConnection() 